import {
  // applyPurposeMap,
  applyPurposeOptions,
  // approvalStatusMap,
  approvalStatusOptions,
  // companyTypeMap,
  // companyTypeOptions,
  professionalFieldMap,
  // professionalFieldOptions,
  projectPrototypeForm,
  // userIdentifyStatusMap,
  userIdentifyStatusOptions,
} from "@/utils";
import { cloneDeep } from "lodash-es";

/**
 * @description: 项目管理筛选项
 */
export const projectFilterForm = projectPrototypeForm
  .concat([
    {
      label: "审核状态",
      key: "status",
      type: "select",
      props: {
        options: approvalStatusOptions,
      },
    },
  ])
  .map((item) => ({ ...item, required: false }));
/**
 * @description: 项目管理表头
 */
export const getProjectTableColumns = () =>
  cloneDeep([
    {
      title: "项目名称",
      dataIndex: "projectName",
      width: 160,
      resizable: true,
      ellipsis: true,
    },
    ...projectPrototypeForm.map((item) => ({
      title: item.label,
      dataIndex: item.key,
      width: 100,
      resizable: true,
      ellipsis: true,
      customRender({ text }: any) {
        return item.map?.[text];
      },
    })),
    {
      title: "创建人",
      dataIndex: "userName",
      width: 100,
      resizable: true,
      ellipsis: true,
    },
    {
      title: "创建日期",
      dataIndex: "createdTime",
      width: 180,
      resizable: true,
      ellipsis: true,
    },
    {
      title: "项目审核状态",
      dataIndex: "statusName",
      width: 120,
      resizable: true,
      ellipsis: true,
      // customRender({ text }: any) {
      //   return approvalStatusMap[text].text;
      // },
    },
    {
      title: "审核人员",
      dataIndex: "approveUserName",
      width: 100,
      resizable: true,
      ellipsis: true,
    },
    {
      title: "操作",
      dataIndex: "action",
      width: 120,
      fixed: "right",
    },
  ]);
/**
 * @description: 项目管理分配审核人员
 */
export const getExpertColumns = () =>
  cloneDeep([
    {
      title: "专家姓名",
      dataIndex: "name",
      width: 100,
      resizable: true,
      ellipsis: true,
    },
    {
      title: "专业领域",
      dataIndex: "professionalField",
      width: 120,
      resizable: true,
      ellipsis: true,
      customRender({ text }: any) {
        return professionalFieldMap[text];
      },
    },
    {
      title: "审核项目数",
      dataIndex: "approvalProjects",
      width: 120,
      resizable: true,
      ellipsis: true,
    },
    // {
    //   title: "审核中项目数",
    //   dataIndex: "inReviewCount",
    //   width: 120,
    //   resizable: true,
    //   ellipsis: true,
    // },
    // {
    //   title: "审核完成项目数",
    //   dataIndex: "reviewDoneCount",
    //   width: 130,
    //   resizable: true,
    //   ellipsis: true,
    // },
    // {
    //   title: "金牌项目审核数",
    //   dataIndex: "goldCount",
    //   width: 130,
    //   resizable: true,
    //   ellipsis: true,
    // },
    // {
    //   title: "银牌项目审核数",
    //   dataIndex: "silverCount",
    //   width: 130,
    //   resizable: true,
    //   ellipsis: true,
    // },
    // {
    //   title: "铜牌项目审核数",
    //   dataIndex: "cuprumCount",
    //   width: 130,
    //   resizable: true,
    //   ellipsis: true,
    // },
  ]);
/**
 * @description: 用户管理筛选项
 */
export const userFilterForm: (FormItem & { key: string })[] = [
  {
    label: "专家资格",
    key: "applyPurpose",
    type: "select",
    required: false,
    props: {
      // mode: "multiple",
      options: applyPurposeOptions,
    },
  },
  {
    label: "认证状态",
    key: "status",
    type: "select",
    required: false,
    props: {
      options: userIdentifyStatusOptions,
    },
  },
];
/**
 * @description: 用户管理表头
 */
export const getUserTableColumns = () =>
  cloneDeep([
    {
      title: "姓名",
      dataIndex: "name",
      width: 160,
      resizable: true,
      ellipsis: true,
    },
    {
      title: "账号",
      dataIndex: "user",
      width: 100,
      resizable: true,
      ellipsis: true,
    },
    {
      title: "电话",
      dataIndex: "phone",
      width: 120,
      resizable: true,
      ellipsis: true,
    },
    {
      title: "单位名称",
      dataIndex: "unitName",
      width: 100,
      resizable: true,
      ellipsis: true,
    },
    {
      title: "单位类型",
      dataIndex: "unitType",
      width: 150,
      resizable: true,
      ellipsis: true,
      // customRender({ text }: any) {
      //   return companyTypeMap[text];
      // },
    },
    {
      title: "单位地址",
      dataIndex: "unitLocation",
      width: 100,
      resizable: true,
      ellipsis: true,
    },
    {
      title: "专业领域",
      dataIndex: "professionalField",
      width: 100,
      resizable: true,
      ellipsis: true,
      // customRender({ text }: any) {
      //   return professionalFieldMap[text];
      // },
    },
    {
      title: "项目个数",
      dataIndex: "projects",
      width: 100,
      resizable: true,
      ellipsis: true,
    },
    {
      title: "项目审核个数",
      dataIndex: "approvalProjects",
      width: 100,
      resizable: true,
      ellipsis: true,
    },
    {
      title: "认证状态",
      dataIndex: "statusName",
      width: 100,
      resizable: true,
      ellipsis: true,
      // customRender: ({ text }: any) => userIdentifyStatusMap[text],
    },
    {
      title: "申请目的",
      dataIndex: "applyPurpose",
      width: 180,
      resizable: true,
      ellipsis: true,
      customRender: ({ text }: any) => text?.join(" "),
      // text.map((item: number) => applyPurposeMap[item]).join(" "),
    },
    {
      title: "操作",
      dataIndex: "action",
      width: 100,
      fixed: "right",
    },
  ]);
/**
 * @description: 用户详情表单
 */
export const userDetailForm: (FormItem & { key: string })[] = [
  {
    label: "姓名",
    key: "name",
    type: "input",
  },
  {
    label: "账号",
    key: "user",
    type: "input",
  },
  {
    label: "电话",
    key: "phone",
    type: "input",
  },
  {
    label: "单位名称",
    key: "unitName",
    type: "input",
  },
  {
    label: "单位类型",
    key: "unitType",
    type: "select",
  },
  {
    label: "单位地址",
    key: "unitLocation",
    type: "input",
  },
  {
    label: "专业领域",
    key: "professionalField",
    type: "input",
  },
];
/**
 * @description: 指标库表头
 */
export const getIndicatorsTableColumns = () =>
  cloneDeep([
    {
      title: "指标库名称",
      dataIndex: "name",
      width: 160,
      resizable: true,
      ellipsis: true,
    },
    {
      title: "版本号",
      dataIndex: "version",
      width: 100,
      resizable: true,
      ellipsis: true,
    },
    {
      title: "适用类型",
      dataIndex: "type",
      width: 100,
      resizable: true,
      ellipsis: true,
    },
    {
      title: "资产组合类型",
      dataIndex: "capital",
      width: 120,
      resizable: true,
      ellipsis: true,
    },
    {
      title: "适用规模",
      dataIndex: "scale",
      width: 100,
      resizable: true,
      ellipsis: true,
    },
    {
      title: "适用阶段",
      dataIndex: "stage",
      width: 150,
      resizable: true,
      ellipsis: true,
      // customRender({ text }: any) {
      //   return companyTypeMap[text];
      // },
    },
    {
      title: "创建人",
      dataIndex: "userName",
      width: 100,
      resizable: true,
      ellipsis: true,
      // customRender({ text }: any) {
      //   return professionalFieldMap[text];
      // },
    },
    {
      title: "创建时间",
      dataIndex: "createdTime",
      width: 180,
      resizable: true,
      ellipsis: true,
    },
    {
      title: "状态",
      dataIndex: "statusName",
      width: 100,
      resizable: true,
      ellipsis: true,
    },
    {
      title: "审核人",
      dataIndex: "approveUserName",
      width: 100,
      resizable: true,
      ellipsis: true,
    },
    {
      title: "操作",
      dataIndex: "action",
      width: 100,
      fixed: "right",
    },
  ]);
